@echo off
echo ========================================
echo 验证用户标签关联表删除完成
echo ========================================

echo 1. 检查已删除的Java文件...
echo.

set "MISSING_FILES=0"

if exist "ruoyi-admin\src\main\java\com\ruoyi\web\controller\homepage\TbUserTagController.java" (
    echo [ERROR] TbUserTagController.java 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] TbUserTagController.java 已删除
)

if exist "ruoyi-admin\src\main\java\com\ruoyi\web\controller\homepage\TestUserTagController.java" (
    echo [ERROR] TestUserTagController.java 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] TestUserTagController.java 已删除
)

if exist "ruoyi-admin\src\main\java\com\ruoyi\homepage\service\impl\TbUserTagServiceImpl.java" (
    echo [ERROR] TbUserTagServiceImpl.java 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] TbUserTagServiceImpl.java 已删除
)

if exist "ruoyi-admin\src\main\java\com\ruoyi\homepage\service\ITbUserTagService.java" (
    echo [ERROR] ITbUserTagService.java 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] ITbUserTagService.java 已删除
)

if exist "ruoyi-admin\src\main\java\com\ruoyi\homepage\mapper\TbUserTagMapper.java" (
    echo [ERROR] TbUserTagMapper.java 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] TbUserTagMapper.java 已删除
)

echo.
echo 2. 检查已删除的配置文件...
echo.

if exist "ruoyi-admin\src\main\resources\mapper\homepage\TbUserTagMapper.xml" (
    echo [ERROR] TbUserTagMapper.xml 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] TbUserTagMapper.xml 已删除
)

echo.
echo 3. 检查已删除的前端文件...
echo.

if exist "RuoYi-Vue3\src\api\homepage\user-tag-relation.js" (
    echo [ERROR] user-tag-relation.js 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] user-tag-relation.js 已删除
)

if exist "RuoYi-Vue3\src\views\homepage\user-tag-relation\index.vue" (
    echo [ERROR] user-tag-relation/index.vue 仍然存在
    set /a MISSING_FILES+=1
) else (
    echo [SUCCESS] user-tag-relation/index.vue 已删除
)

echo.
echo 4. 检查保留的文件...
echo.

if exist "ruoyi-admin\src\main\java\com\ruoyi\web\controller\homepage\TbTagController.java" (
    echo [SUCCESS] TbTagController.java 保留
) else (
    echo [WARNING] TbTagController.java 缺失
)

if exist "RuoYi-Vue3\src\views\homepage\user-tags\index.vue" (
    echo [SUCCESS] user-tags/index.vue 保留
) else (
    echo [WARNING] user-tags/index.vue 缺失
)

echo.
echo ========================================
echo 验证结果
echo ========================================

if %MISSING_FILES% equ 0 (
    echo [SUCCESS] 所有用户标签关联相关文件已成功删除！
    echo.
    echo 下一步操作：
    echo 1. 重启后端服务
    echo 2. 执行数据库清理脚本：delete_user_tag_relation.sql
    echo 3. 测试系统功能是否正常
) else (
    echo [ERROR] 发现 %MISSING_FILES% 个文件未正确删除
    echo 请手动检查并删除这些文件
)

echo ========================================
pause
